/************************ 类型 *********************************/
// 病友圈详情params参数类型

import { getHttp, postHttpJSON, postHttpMulti, postHttpParams,deleteHttp,postHttp,putHttpParams } from ".."



export interface pathentCircleDetailParamsStart {
  sickCircleId: number;
}
// 病友圈详情header参数类型
export interface pathentCircleDetailheaderStart {
  userId: number;
  sessionId: string;
}
// 病友圈详情回调参数类型
export interface pathentCircleDetailDataStart {
  sickCircleId: number;
  authorUserId: number;
  departmentId: number;
  adoptFlag: number;
  title: string;
  department: string;
  disease: string;
  detail: string;
  treatmentHospital: string;
  treatmentStartTime: string;
  treatmentEndTime: string;
  treatmentProcess: string;
  picture: string;
  collectionFlag: number;
  collectionNum: string;
  commentNum: number;
  adoptNickName: string;
  adoptHeadPic: string;
  adoptComment: string;
  adoptTime: number;
}
// 结果页返回数据类型
export interface pathienCirclehistoryList {
  sickCircleId: number;
  userId?: number;
  title: string;
  detail: string;
  releaseTime: number;
  collectionNum: number;
  commentNum: number;
  amount: number;
}
// 发布病友圈hooks参数类型
export interface fromdata {
  title: string;
  departmentId: number | null;
  disease: string;
  detail: string;
  treatmentHospital: string;
  treatmentStartTime: string;
  treatmentEndTime: string;
  treatmentProcess: string;
  amount: number | null;
}
// 发布病友圈hooks返回值类型

export interface fromdataRawState {
  status: string;
  message: string;
  result: number;
}
// 问诊类型
export interface KnowledgeBaseRawState {
  departmentName: string;
  id: number;
  pic: string;
  rank: number;
}
// 病症类型
export interface KnowlegeListItem {
  departmentId: number;
  id: number;
  name: string;
}
/************************ 类型 *********************************/
// 病友圈首页列表类型
export interface pathienCircleHomeList {
  sickCircleId: number;
  userId?: number;
  title: string;
  detail: string;
  releaseTime: number;
  collectionNum: number;
  commentNum: number;
  amount: number;
}
// 病友圈首页参数类型
export interface pathienCircleHomeListRawState {
  departmentId: number;
  page: number;
  count: number;
}

// 病友圈图片上传参数类型
interface upload {
    sickCircleId: number
    picture: File
}

// 收藏病友圈参数类型
export interface SickCollectionParamsState {
  sickCircleId: number;
}

// 病友圈列表参数
export interface CommentListParamsState {
  sickCircleId: number;
  page: number;
  count: number;
}
// 赞同/反对病友圈评论参数
export interface ExpressOpinionParamsState {
  commentId: number;
  opinion: number;
}

// 病友圈发表评论参数
export interface PublishCommentParamsState {
  sickCircleId: number;
  content: string;
}
// 他的病友圈参数
export interface HisPatientsParamsState{
  patientUserId:number,
  page:number,
  count:number
}
// 他的病友圈返回数据参数
export interface HisPatientsRowState{
  sickCircleId:number
  title:string
  detail:string
  amount:number
  collectionNum:number
  commentNum:number
  releaseTime:number
}
/************************ 接口 *********************************/
// 病友圈首页列表接口
export const getpathienCircle = (params: pathienCircleHomeListRawState) =>
  getHttp("/health/user/sickCircle/v1/findSickCircleList", params);

// 问诊咨询接口
export const getKnowledgeBase = () =>
  getHttp("/health/share/knowledgeBase/v1/findDepartment");

// 他的病友圈接口
export const getHisPatient = (params: HisPatientsParamsState) =>
  getHttp("/health/user/sickCircle/v1/findPatientSickCircleList", params);
// 病友详情页数据接口接口
export const getpathentCircleDetail = (params: pathentCircleDetailParamsStart) => getHttp("/health/user/sickCircle/v1/findSickCircleInfo", params);
// 发布病友圈接口 
export const postpatients = (data: fromdata) => postHttpJSON('/health/user/sickCircle/verify/v1/publishSickCircle', data)

// 图片上传接口

export const postupload = (
    sickCircleId:number,
    picture:File
  ) =>{
    const formdata=new FormData()
    formdata.append('picture',picture)
    formdata.append('sickCircleId',sickCircleId.toString())
    return postHttpMulti(
        "/health/user/sickCircle/verify/v1/uploadSickCirclePicture",
        formdata,
        {}
      );
  }
    
//   收藏病友圈接口
export const postCollection = (data: SickCollectionParamsState) =>
  postHttp("/health/user/verify/v1/addUserSickCollection", data);

//   取消收藏病友圈接口
export const deleteCollection = (params: SickCollectionParamsState) =>
  deleteHttp("/health/user/verify/v1/cancelSickCollection", params);
// 查询病友圈评论列表
export const getCircleComment = (params: CommentListParamsState) =>
  getHttp("/health/user/sickCircle/v1/findSickCircleCommentList", params);

// 赞同/反对病友圈评论
export const putExpressOpinion = (params: ExpressOpinionParamsState) =>
  putHttpParams("/health/user/sickCircle/verify/v1/expressOpinion", params);

// 病友圈发表评论
export const postpbComment = (data: PublishCommentParamsState) =>
  postHttp("/health/user/sickCircle/verify/v1/publishComment", data);

